//! # 网络配置模块
//! 
//! 定义网络相关的配置结构。

use serde::{Deserialize, Serialize};

/// 网络配置
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetworkConfig {
    /// 服务监听端口
    pub port: u16,
    
    /// 健康检查端口
    pub health_port: u16,
    
    /// 管理端口
    pub admin_port: Option<u16>,
    
    /// 绑定地址
    pub bind_address: String,
    
    /// TLS配置
    pub tls: Option<TlsConfig>,
}

impl Default for NetworkConfig {
    fn default() -> Self {
        // 注意：这里使用默认值，实际项目中应该从crate::defaults导入
        Self {
            port: 8080,
            health_port: 8081,
            admin_port: None,
            bind_address: "0.0.0.0".to_string(),
            tls: None,
        }
    }
}

/// TLS配置
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TlsConfig {
    /// 是否启用TLS
    pub enabled: bool,
    
    /// 证书文件路径
    pub cert_file: String,
    
    /// 私钥文件路径
    pub key_file: String,
    
    /// CA证书文件路径
    pub ca_file: Option<String>,
}